package org.deschutter.hibernate;

import javax.persistence.*;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:12
 */
@Entity
@Table(catalog = "scimitar", name = "channels")
public class Channels {
    private byte id;

    @Id
    @Column(name = "ID")
    public byte getId() {
        return id;
    }

    public void setId(byte id) {
        this.id = id;
    }

    private String channel;

    @Basic
    @Column(name = "channel")
    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Channels channels = (Channels) o;

        if (id != channels.id) return false;
        if (channel != null ? !channel.equals(channels.channel) : channels.channel != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) id;
        result = 31 * result + (channel != null ? channel.hashCode() : 0);
        return result;
    }

    private ChannelTypes channelTypesByChannelType;

    @ManyToOne
    @JoinColumn(name = "channel_type", referencedColumnName = "ID", nullable = false)
    public ChannelTypes getChannelTypesByChannelType() {
        return channelTypesByChannelType;
    }

    public void setChannelTypesByChannelType(ChannelTypes channelTypesByChannelType) {
        this.channelTypesByChannelType = channelTypesByChannelType;
    }
}
